package com.easy.common.enumbean;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;

public enum Gender {
    //男性，女性
    MALE("男"), FEMALE("女");
    @EnumValue
    private String value;
    private Gender(String value){
        this.value=value;
    }

    @JsonCreator
    public  Gender convert(String val){
        switch (val){
            case "男":
                return MALE;
            case "女":
                return FEMALE;
            default:
                throw new RuntimeException("没有对应的枚举类型");
        }
    }

    public String valueOf(){
        return this.value;
    }
    public String toString(){
        return this.value;
    }
}
